﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Ras2Logic;

namespace Ras2Web
{
    /// <summary>
    /// Klasinn PerformerDetail
    /// </summary>
    public partial class PerformerDetail : System.Web.UI.Page
    {
        /// <summary>
        /// Fall sem nær í allar upplýsingar um ákveðinn flytjanda, athugasemdir,
        /// vefslóð, ljósmynd og öll lög eftir hann sem eru í gagnagrunninum.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                String strID = Request.QueryString["ID"];
                int nID = 0;

                if (Int32.TryParse(strID, out nID))
                {
                    this.ViewState["PerformerID"] = strID;

                    PerformerController ctrl = new PerformerController();
                    Performer performer = ctrl.GetPerformerById(nID);

                    SongController sctrl = new SongController();
               
                    if (performer != null)
                    {
                        m_txtName.Text = performer.Name;
                        m_txtDescription.Text = performer.Description;
                        m_txtURL.Text = performer.Url;
                        m_txtPic.Text = performer.Image;
                        m_gridViewPerformerSongs.DataSource = sctrl.GetSongsByPerformerID(nID);
                        m_gridViewPerformerSongs.DataBind();
                    }
                }
            }
        }
    }
}
